/*
 * @Author: HZK
 * @Date: 2020-12-01 13:57:07
 * @LastEditTime: 2020-12-01 20:44:22
 * @LastEditors: hanfengmi
 * @Description: 全局store
 */
import { 
    getList
} from '@/servise/global';
export default {
    namespace: 'global',
    state: {
        list:[]
    },
    effects: {
        *getList({ payload }, { call,put }) { // 获取列表
            const response = yield call(getList,payload);
            if(response.Success){
                yield put({
                    type:'save',
                    payload:{
                        list: [
                            {
                              key: '1',
                              name: '马云',
                              age: 32,
                              address: '有钱村',
                              tags: ['rish', 'very rich', 'teacher'],
                            },
                            {
                              key: '2',
                              name: '马某国',
                              age: 42,
                              address: '北京',
                              tags: ['loser', 'kongfu'],
                            },
                            {
                              key: '3',
                              name: '马华腾',
                              age: 32,
                              address: 'QQ镇',
                              tags: ['cool', 'teacher'],
                            },
                        ]
                    }
                })
            }
        }
    },
    reducers: {
        save(state, { payload }) {
            return {
                ...state,
                ...payload,
            };
        },
    },
  };
